﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:ec="clr-namespace:Microsoft.Expression.Controls;assembly=Microsoft.Expression.Controls"
    xmlns:local="clr-namespace:Kinect.Framework.Controls">
    <Style TargetType="{x:Type local:KinectButton}">
        <Setter Property="Background" Value="#FFFF0000"/>
        <Setter Property="Foreground" Value="#FF000000"/>
        <Setter Property="Padding" Value="0"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="BorderBrush" Value="Transparent"/>

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:KinectButton}">
                    <Grid>
                        <Rectangle Fill="Transparent" Width="Auto" Height="Auto"/>                        
                        <ContentPresenter
                              x:Name="contentPresenter"
                              Width="Auto" Height="Auto"
                              Content="{TemplateBinding Content}"
                              ContentTemplate="{TemplateBinding ContentTemplate}"
                              VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                              HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                              Margin="{TemplateBinding Padding}"/>

                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style TargetType="{x:Type local:KinectContextMenu}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:KinectContextMenu}">
                    <Canvas>
                        <Ellipse x:Name="HitTestZone" Fill="Transparent"/>
                        <ItemsPresenter x:Name="Content"/>
                    </Canvas>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <Canvas/>
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>

    </Style>
    <Style TargetType="{x:Type local:KinectWindow}">
        <Setter Property="WindowState"  Value="{Binding WindowState}"/>
        <Setter Property="WindowStyle"  Value="{Binding WindowStyle}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:KinectWindow}">
                    <Grid Background="{TemplateBinding Background}">
                        <ContentControl Margin="0" Content="{TemplateBinding Content}"/>
                        <ItemsControl IsHitTestVisible="False" ItemsSource="{TemplateBinding KinectPointers}" HorizontalAlignment="Left" VerticalAlignment="Top">
                            <ItemsControl.ItemsPanel>
                                <ItemsPanelTemplate>
                                    <Canvas/>
                                </ItemsPanelTemplate>
                            </ItemsControl.ItemsPanel>
                            <ItemsControl.ItemTemplate>
                                <DataTemplate>
                                    <ContentControl Margin="0" Content="{Binding}" Background="Transparent"/>
                                </DataTemplate>
                            </ItemsControl.ItemTemplate>
                        </ItemsControl>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style TargetType="{x:Type local:KinectPointer}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:KinectPointer}">
                    <Grid Background="Transparent" IsHitTestVisible="False">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Loading">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.StrokeThickness)" Storyboard.TargetName="Loader">
                                            <EasingDoubleKeyFrame KeyTime="0:0:0.4" Value="0"/>
                                            <EasingDoubleKeyFrame KeyTime="0:0:2" Value="20"/>
                                            <EasingDoubleKeyFrame KeyTime="0:0:3" Value="0"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="StopLoading">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.StrokeThickness)" Storyboard.TargetName="Loader">
                                            <EasingDoubleKeyFrame KeyTime="0" Value="0"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>

                        <TextBlock IsHitTestVisible="False" Visibility="Collapsed" x:Name="Count" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                        <Grid IsHitTestVisible="False" HorizontalAlignment="Stretch" Height="90" VerticalAlignment="Stretch" Width="90">
                            <Ellipse IsHitTestVisible="False" HorizontalAlignment="Right" Height="90" Margin="0" Stroke="Black" VerticalAlignment="Bottom" Width="90" StrokeThickness="5"/>
                            <Ellipse IsHitTestVisible="False" Fill="#00000000" HorizontalAlignment="Right" Height="80" Margin="0,0,5,5" Stroke="#FFB4B4B4" VerticalAlignment="Bottom" Width="80" StrokeThickness="10"/>
                        </Grid>
                        <Image IsHitTestVisible="False" Source="/Assets/Images/cursor.png" Stretch="Uniform" Width="40" Margin="23,-1,27,1"/>
                        <Ellipse IsHitTestVisible="False" x:Name="Loader" Fill="#00FF0000" HorizontalAlignment="Right" Height="80" Margin="0,0,5,5" Stroke="Red" VerticalAlignment="Bottom" Width="80" StrokeThickness="0"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type local:KinectListBox}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:KinectListBox}">
                    <Grid>
                        <Rectangle VerticalAlignment="Center" Height="80" x:Name="PART_ContentSelectedZone" Margin="0,0,0,0"/>
                        <local:KinectListBoxScrollViewer Grid.Row="1" x:Name="PART_ContentAnimatedScrollViewer"
                    VerticalScrollBarVisibility="Hidden" 
                    HorizontalScrollBarVisibility="Hidden">
                            <ListBox ItemsPanel="{TemplateBinding ItemsPanel}" ItemContainerStyle="{TemplateBinding ItemContainerStyle}"  Background="{TemplateBinding Background}" ItemsSource="{TemplateBinding ItemsSource}" ClipToBounds="False" Name="PART_ContentListbox" Width="Auto" BorderBrush="Transparent" BorderThickness="0"
                                 ScrollViewer.CanContentScroll="False"
                  ScrollViewer.VerticalScrollBarVisibility="Hidden" 
                  ScrollViewer.HorizontalScrollBarVisibility="Hidden" ItemTemplate="{TemplateBinding ItemTemplate}"/>
                        </local:KinectListBoxScrollViewer>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>
